#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>

int IsRotation(char* arr1, char* arr2)
{
	int len1 = strlen(arr1);
	int len2 = strlen(arr2);
	if (len2 != len1)
	{
		return 0;
	}

	strncat(arr1, arr1, len1);

	return strstr(arr1, arr2) != NULL;
}

int main()
{
	char str1[20] = "ABCDEF";
	char str2[] = "EFABCM";
	int ret = IsRotation(str1, str2);
	if (1 == ret)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}
	return 0;
}